/*
 * Copyright 2018- The Pixie Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

syntax = "proto3";

package px.stirling.sockeventpb;

option go_package = "sockeventpb";

// We do not use enum, instead use integer value to avoid tedious type conversions between C++ and
// protobuf.

message ConnID {
  // User land PID, equivalent to TGID in the BPF and kernel land.
  uint32 pid = 1;
  uint64 start_time_ns = 2;
  uint32 fd = 3;
  uint32 generation = 4;
}

message SocketDataEvent {
  message Attribute {
    uint64 timestamp_ns = 1;
    ConnID conn_id = 2;
    uint32 protocol = 3;
    uint32 role = 4;
    uint32 direction = 5;
    uint64 pos = 6;
    // The original size of the msg, could be larger than the size of msg.
    uint32 msg_size = 7;
  }
  Attribute attr = 1;
  bytes msg = 2;
}
